﻿///////////////////////////////////////////////////////////////
// This is generated code. 
//////////////////////////////////////////////////////////////
// Code is generated using LLBLGen Pro version: 3.5
// Code is generated on: Monday, December 17, 2012 11:21:25 AM
// Code is generated using templates: SD.TemplateBindings.SharedTemplates.NET35
// Templates vendor: Solutions Design.
//////////////////////////////////////////////////////////////
using System;
using System.Collections.Generic;
using SD.LLBLGen.Pro.LinqSupportClasses;
using SD.LLBLGen.Pro.ORMSupportClasses;

using WHMS;
using WHMS.EntityClasses;
using WHMS.FactoryClasses;
using WHMS.HelperClasses;
using WHMS.RelationClasses;

namespace WHMS.Linq
{
	/// <summary>Meta-data class for the construction of Linq queries which are to be executed using LLBLGen Pro code.</summary>
	public partial class LinqMetaData: ILinqMetaData
	{
		#region Class Member Declarations
		private IDataAccessAdapter _adapterToUse;
		private FunctionMappingStore _customFunctionMappings;
		private Context _contextToUse;
		#endregion
		
		/// <summary>CTor. Using this ctor will leave the IDataAccessAdapter object to use empty. To be able to execute the query, an IDataAccessAdapter instance
		/// is required, and has to be set on the LLBLGenProProvider2 object in the query to execute. </summary>
		public LinqMetaData() : this(null, null)
		{
		}
		
		/// <summary>CTor which accepts an IDataAccessAdapter implementing object, which will be used to execute queries created with this metadata class.</summary>
		/// <param name="adapterToUse">the IDataAccessAdapter to use in queries created with this meta data</param>
		/// <remarks> Be aware that the IDataAccessAdapter object set via this property is kept alive by the LLBLGenProQuery objects created with this meta data
		/// till they go out of scope.</remarks>
		public LinqMetaData(IDataAccessAdapter adapterToUse) : this (adapterToUse, null)
		{
		}

		/// <summary>CTor which accepts an IDataAccessAdapter implementing object, which will be used to execute queries created with this metadata class.</summary>
		/// <param name="adapterToUse">the IDataAccessAdapter to use in queries created with this meta data</param>
		/// <param name="customFunctionMappings">The custom function mappings to use. These take higher precedence than the ones in the DQE to use.</param>
		/// <remarks> Be aware that the IDataAccessAdapter object set via this property is kept alive by the LLBLGenProQuery objects created with this meta data
		/// till they go out of scope.</remarks>
		public LinqMetaData(IDataAccessAdapter adapterToUse, FunctionMappingStore customFunctionMappings)
		{
			_adapterToUse = adapterToUse;
			_customFunctionMappings = customFunctionMappings;
		}
	
		/// <summary>returns the datasource to use in a Linq query for the entity type specified</summary>
		/// <param name="typeOfEntity">the type of the entity to get the datasource for</param>
		/// <returns>the requested datasource</returns>
		public IDataSource GetQueryableForEntity(int typeOfEntity)
		{
			IDataSource toReturn = null;
			switch((WHMS.EntityType)typeOfEntity)
			{
				case WHMS.EntityType.ContractorEntity:
					toReturn = this.Contractor;
					break;
				case WHMS.EntityType.CurrencyEntity:
					toReturn = this.Currency;
					break;
				case WHMS.EntityType.DepositTransactionEntity:
					toReturn = this.DepositTransaction;
					break;
				case WHMS.EntityType.DepositTypeEntity:
					toReturn = this.DepositType;
					break;
				case WHMS.EntityType.InitialBalanceEntity:
					toReturn = this.InitialBalance;
					break;
				case WHMS.EntityType.InspectionTypeEntity:
					toReturn = this.InspectionType;
					break;
				case WHMS.EntityType.InventoryEntity:
					toReturn = this.Inventory;
					break;
				case WHMS.EntityType.InventoryItemEntity:
					toReturn = this.InventoryItem;
					break;
				case WHMS.EntityType.ItemEntity:
					toReturn = this.Item;
					break;
				case WHMS.EntityType.ItemSupplierEntity:
					toReturn = this.ItemSupplier;
					break;
				case WHMS.EntityType.ItemTypeEntity:
					toReturn = this.ItemType;
					break;
				case WHMS.EntityType.ProjectEntity:
					toReturn = this.Project;
					break;
				case WHMS.EntityType.ProjectContractorEntity:
					toReturn = this.ProjectContractor;
					break;
				case WHMS.EntityType.ProjectItemPlanEntity:
					toReturn = this.ProjectItemPlan;
					break;
				case WHMS.EntityType.RetrievalTransactionEntity:
					toReturn = this.RetrievalTransaction;
					break;
				case WHMS.EntityType.RoleEntity:
					toReturn = this.Role;
					break;
				case WHMS.EntityType.ShelfEntity:
					toReturn = this.Shelf;
					break;
				case WHMS.EntityType.ShelfTypeEntity:
					toReturn = this.ShelfType;
					break;
				case WHMS.EntityType.StoreEntity:
					toReturn = this.Store;
					break;
				case WHMS.EntityType.StorekeeperEntity:
					toReturn = this.Storekeeper;
					break;
				case WHMS.EntityType.StoreShelfBalanceEntity:
					toReturn = this.StoreShelfBalance;
					break;
				case WHMS.EntityType.SupplierEntity:
					toReturn = this.Supplier;
					break;
				case WHMS.EntityType.SupplyOrderEntity:
					toReturn = this.SupplyOrder;
					break;
				case WHMS.EntityType.SupplyOrderItemEntity:
					toReturn = this.SupplyOrderItem;
					break;
				case WHMS.EntityType.TransactionEntity:
					toReturn = this.Transaction;
					break;
				case WHMS.EntityType.TransactionItemEntity:
					toReturn = this.TransactionItem;
					break;
				case WHMS.EntityType.TransferRequestEntity:
					toReturn = this.TransferRequest;
					break;
				case WHMS.EntityType.TransferRequestItemEntity:
					toReturn = this.TransferRequestItem;
					break;
				case WHMS.EntityType.TransferTransactionEntity:
					toReturn = this.TransferTransaction;
					break;
				case WHMS.EntityType.UnitEntity:
					toReturn = this.Unit;
					break;
				case WHMS.EntityType.UnitConverterEntity:
					toReturn = this.UnitConverter;
					break;
				case WHMS.EntityType.UnitTypeEntity:
					toReturn = this.UnitType;
					break;
				case WHMS.EntityType.UserEntity:
					toReturn = this.User;
					break;
				case WHMS.EntityType.UserRoleEntity:
					toReturn = this.UserRole;
					break;
				case WHMS.EntityType.WithdrawalTypeEntity:
					toReturn = this.WithdrawalType;
					break;
				case WHMS.EntityType.WithdrawRequestEntity:
					toReturn = this.WithdrawRequest;
					break;
				case WHMS.EntityType.WithdrawRequestItemEntity:
					toReturn = this.WithdrawRequestItem;
					break;
				case WHMS.EntityType.WithdrawTransactionEntity:
					toReturn = this.WithdrawTransaction;
					break;
				case WHMS.EntityType.WithdrawzPartyEntity:
					toReturn = this.WithdrawzParty;
					break;
				default:
					toReturn = null;
					break;
			}
			return toReturn;
		}

		/// <summary>returns the datasource to use in a Linq query when targeting ContractorEntity instances in the database.</summary>
		public DataSource2<ContractorEntity> Contractor
		{
			get { return new DataSource2<ContractorEntity>(_adapterToUse, new ElementCreator(), _customFunctionMappings, _contextToUse); }
		}
		
		/// <summary>returns the datasource to use in a Linq query when targeting CurrencyEntity instances in the database.</summary>
		public DataSource2<CurrencyEntity> Currency
		{
			get { return new DataSource2<CurrencyEntity>(_adapterToUse, new ElementCreator(), _customFunctionMappings, _contextToUse); }
		}
		
		/// <summary>returns the datasource to use in a Linq query when targeting DepositTransactionEntity instances in the database.</summary>
		public DataSource2<DepositTransactionEntity> DepositTransaction
		{
			get { return new DataSource2<DepositTransactionEntity>(_adapterToUse, new ElementCreator(), _customFunctionMappings, _contextToUse); }
		}
		
		/// <summary>returns the datasource to use in a Linq query when targeting DepositTypeEntity instances in the database.</summary>
		public DataSource2<DepositTypeEntity> DepositType
		{
			get { return new DataSource2<DepositTypeEntity>(_adapterToUse, new ElementCreator(), _customFunctionMappings, _contextToUse); }
		}
		
		/// <summary>returns the datasource to use in a Linq query when targeting InitialBalanceEntity instances in the database.</summary>
		public DataSource2<InitialBalanceEntity> InitialBalance
		{
			get { return new DataSource2<InitialBalanceEntity>(_adapterToUse, new ElementCreator(), _customFunctionMappings, _contextToUse); }
		}
		
		/// <summary>returns the datasource to use in a Linq query when targeting InspectionTypeEntity instances in the database.</summary>
		public DataSource2<InspectionTypeEntity> InspectionType
		{
			get { return new DataSource2<InspectionTypeEntity>(_adapterToUse, new ElementCreator(), _customFunctionMappings, _contextToUse); }
		}
		
		/// <summary>returns the datasource to use in a Linq query when targeting InventoryEntity instances in the database.</summary>
		public DataSource2<InventoryEntity> Inventory
		{
			get { return new DataSource2<InventoryEntity>(_adapterToUse, new ElementCreator(), _customFunctionMappings, _contextToUse); }
		}
		
		/// <summary>returns the datasource to use in a Linq query when targeting InventoryItemEntity instances in the database.</summary>
		public DataSource2<InventoryItemEntity> InventoryItem
		{
			get { return new DataSource2<InventoryItemEntity>(_adapterToUse, new ElementCreator(), _customFunctionMappings, _contextToUse); }
		}
		
		/// <summary>returns the datasource to use in a Linq query when targeting ItemEntity instances in the database.</summary>
		public DataSource2<ItemEntity> Item
		{
			get { return new DataSource2<ItemEntity>(_adapterToUse, new ElementCreator(), _customFunctionMappings, _contextToUse); }
		}
		
		/// <summary>returns the datasource to use in a Linq query when targeting ItemSupplierEntity instances in the database.</summary>
		public DataSource2<ItemSupplierEntity> ItemSupplier
		{
			get { return new DataSource2<ItemSupplierEntity>(_adapterToUse, new ElementCreator(), _customFunctionMappings, _contextToUse); }
		}
		
		/// <summary>returns the datasource to use in a Linq query when targeting ItemTypeEntity instances in the database.</summary>
		public DataSource2<ItemTypeEntity> ItemType
		{
			get { return new DataSource2<ItemTypeEntity>(_adapterToUse, new ElementCreator(), _customFunctionMappings, _contextToUse); }
		}
		
		/// <summary>returns the datasource to use in a Linq query when targeting ProjectEntity instances in the database.</summary>
		public DataSource2<ProjectEntity> Project
		{
			get { return new DataSource2<ProjectEntity>(_adapterToUse, new ElementCreator(), _customFunctionMappings, _contextToUse); }
		}
		
		/// <summary>returns the datasource to use in a Linq query when targeting ProjectContractorEntity instances in the database.</summary>
		public DataSource2<ProjectContractorEntity> ProjectContractor
		{
			get { return new DataSource2<ProjectContractorEntity>(_adapterToUse, new ElementCreator(), _customFunctionMappings, _contextToUse); }
		}
		
		/// <summary>returns the datasource to use in a Linq query when targeting ProjectItemPlanEntity instances in the database.</summary>
		public DataSource2<ProjectItemPlanEntity> ProjectItemPlan
		{
			get { return new DataSource2<ProjectItemPlanEntity>(_adapterToUse, new ElementCreator(), _customFunctionMappings, _contextToUse); }
		}
		
		/// <summary>returns the datasource to use in a Linq query when targeting RetrievalTransactionEntity instances in the database.</summary>
		public DataSource2<RetrievalTransactionEntity> RetrievalTransaction
		{
			get { return new DataSource2<RetrievalTransactionEntity>(_adapterToUse, new ElementCreator(), _customFunctionMappings, _contextToUse); }
		}
		
		/// <summary>returns the datasource to use in a Linq query when targeting RoleEntity instances in the database.</summary>
		public DataSource2<RoleEntity> Role
		{
			get { return new DataSource2<RoleEntity>(_adapterToUse, new ElementCreator(), _customFunctionMappings, _contextToUse); }
		}
		
		/// <summary>returns the datasource to use in a Linq query when targeting ShelfEntity instances in the database.</summary>
		public DataSource2<ShelfEntity> Shelf
		{
			get { return new DataSource2<ShelfEntity>(_adapterToUse, new ElementCreator(), _customFunctionMappings, _contextToUse); }
		}
		
		/// <summary>returns the datasource to use in a Linq query when targeting ShelfTypeEntity instances in the database.</summary>
		public DataSource2<ShelfTypeEntity> ShelfType
		{
			get { return new DataSource2<ShelfTypeEntity>(_adapterToUse, new ElementCreator(), _customFunctionMappings, _contextToUse); }
		}
		
		/// <summary>returns the datasource to use in a Linq query when targeting StoreEntity instances in the database.</summary>
		public DataSource2<StoreEntity> Store
		{
			get { return new DataSource2<StoreEntity>(_adapterToUse, new ElementCreator(), _customFunctionMappings, _contextToUse); }
		}
		
		/// <summary>returns the datasource to use in a Linq query when targeting StorekeeperEntity instances in the database.</summary>
		public DataSource2<StorekeeperEntity> Storekeeper
		{
			get { return new DataSource2<StorekeeperEntity>(_adapterToUse, new ElementCreator(), _customFunctionMappings, _contextToUse); }
		}
		
		/// <summary>returns the datasource to use in a Linq query when targeting StoreShelfBalanceEntity instances in the database.</summary>
		public DataSource2<StoreShelfBalanceEntity> StoreShelfBalance
		{
			get { return new DataSource2<StoreShelfBalanceEntity>(_adapterToUse, new ElementCreator(), _customFunctionMappings, _contextToUse); }
		}
		
		/// <summary>returns the datasource to use in a Linq query when targeting SupplierEntity instances in the database.</summary>
		public DataSource2<SupplierEntity> Supplier
		{
			get { return new DataSource2<SupplierEntity>(_adapterToUse, new ElementCreator(), _customFunctionMappings, _contextToUse); }
		}
		
		/// <summary>returns the datasource to use in a Linq query when targeting SupplyOrderEntity instances in the database.</summary>
		public DataSource2<SupplyOrderEntity> SupplyOrder
		{
			get { return new DataSource2<SupplyOrderEntity>(_adapterToUse, new ElementCreator(), _customFunctionMappings, _contextToUse); }
		}
		
		/// <summary>returns the datasource to use in a Linq query when targeting SupplyOrderItemEntity instances in the database.</summary>
		public DataSource2<SupplyOrderItemEntity> SupplyOrderItem
		{
			get { return new DataSource2<SupplyOrderItemEntity>(_adapterToUse, new ElementCreator(), _customFunctionMappings, _contextToUse); }
		}
		
		/// <summary>returns the datasource to use in a Linq query when targeting TransactionEntity instances in the database.</summary>
		public DataSource2<TransactionEntity> Transaction
		{
			get { return new DataSource2<TransactionEntity>(_adapterToUse, new ElementCreator(), _customFunctionMappings, _contextToUse); }
		}
		
		/// <summary>returns the datasource to use in a Linq query when targeting TransactionItemEntity instances in the database.</summary>
		public DataSource2<TransactionItemEntity> TransactionItem
		{
			get { return new DataSource2<TransactionItemEntity>(_adapterToUse, new ElementCreator(), _customFunctionMappings, _contextToUse); }
		}
		
		/// <summary>returns the datasource to use in a Linq query when targeting TransferRequestEntity instances in the database.</summary>
		public DataSource2<TransferRequestEntity> TransferRequest
		{
			get { return new DataSource2<TransferRequestEntity>(_adapterToUse, new ElementCreator(), _customFunctionMappings, _contextToUse); }
		}
		
		/// <summary>returns the datasource to use in a Linq query when targeting TransferRequestItemEntity instances in the database.</summary>
		public DataSource2<TransferRequestItemEntity> TransferRequestItem
		{
			get { return new DataSource2<TransferRequestItemEntity>(_adapterToUse, new ElementCreator(), _customFunctionMappings, _contextToUse); }
		}
		
		/// <summary>returns the datasource to use in a Linq query when targeting TransferTransactionEntity instances in the database.</summary>
		public DataSource2<TransferTransactionEntity> TransferTransaction
		{
			get { return new DataSource2<TransferTransactionEntity>(_adapterToUse, new ElementCreator(), _customFunctionMappings, _contextToUse); }
		}
		
		/// <summary>returns the datasource to use in a Linq query when targeting UnitEntity instances in the database.</summary>
		public DataSource2<UnitEntity> Unit
		{
			get { return new DataSource2<UnitEntity>(_adapterToUse, new ElementCreator(), _customFunctionMappings, _contextToUse); }
		}
		
		/// <summary>returns the datasource to use in a Linq query when targeting UnitConverterEntity instances in the database.</summary>
		public DataSource2<UnitConverterEntity> UnitConverter
		{
			get { return new DataSource2<UnitConverterEntity>(_adapterToUse, new ElementCreator(), _customFunctionMappings, _contextToUse); }
		}
		
		/// <summary>returns the datasource to use in a Linq query when targeting UnitTypeEntity instances in the database.</summary>
		public DataSource2<UnitTypeEntity> UnitType
		{
			get { return new DataSource2<UnitTypeEntity>(_adapterToUse, new ElementCreator(), _customFunctionMappings, _contextToUse); }
		}
		
		/// <summary>returns the datasource to use in a Linq query when targeting UserEntity instances in the database.</summary>
		public DataSource2<UserEntity> User
		{
			get { return new DataSource2<UserEntity>(_adapterToUse, new ElementCreator(), _customFunctionMappings, _contextToUse); }
		}
		
		/// <summary>returns the datasource to use in a Linq query when targeting UserRoleEntity instances in the database.</summary>
		public DataSource2<UserRoleEntity> UserRole
		{
			get { return new DataSource2<UserRoleEntity>(_adapterToUse, new ElementCreator(), _customFunctionMappings, _contextToUse); }
		}
		
		/// <summary>returns the datasource to use in a Linq query when targeting WithdrawalTypeEntity instances in the database.</summary>
		public DataSource2<WithdrawalTypeEntity> WithdrawalType
		{
			get { return new DataSource2<WithdrawalTypeEntity>(_adapterToUse, new ElementCreator(), _customFunctionMappings, _contextToUse); }
		}
		
		/// <summary>returns the datasource to use in a Linq query when targeting WithdrawRequestEntity instances in the database.</summary>
		public DataSource2<WithdrawRequestEntity> WithdrawRequest
		{
			get { return new DataSource2<WithdrawRequestEntity>(_adapterToUse, new ElementCreator(), _customFunctionMappings, _contextToUse); }
		}
		
		/// <summary>returns the datasource to use in a Linq query when targeting WithdrawRequestItemEntity instances in the database.</summary>
		public DataSource2<WithdrawRequestItemEntity> WithdrawRequestItem
		{
			get { return new DataSource2<WithdrawRequestItemEntity>(_adapterToUse, new ElementCreator(), _customFunctionMappings, _contextToUse); }
		}
		
		/// <summary>returns the datasource to use in a Linq query when targeting WithdrawTransactionEntity instances in the database.</summary>
		public DataSource2<WithdrawTransactionEntity> WithdrawTransaction
		{
			get { return new DataSource2<WithdrawTransactionEntity>(_adapterToUse, new ElementCreator(), _customFunctionMappings, _contextToUse); }
		}
		
		/// <summary>returns the datasource to use in a Linq query when targeting WithdrawzPartyEntity instances in the database.</summary>
		public DataSource2<WithdrawzPartyEntity> WithdrawzParty
		{
			get { return new DataSource2<WithdrawzPartyEntity>(_adapterToUse, new ElementCreator(), _customFunctionMappings, _contextToUse); }
		}
		
		
		#region Class Property Declarations
		/// <summary> Gets / sets the IDataAccessAdapter to use for the queries created with this meta data object.</summary>
		/// <remarks> Be aware that the IDataAccessAdapter object set via this property is kept alive by the LLBLGenProQuery objects created with this meta data
		/// till they go out of scope.</remarks>
		public IDataAccessAdapter AdapterToUse
		{
			get { return _adapterToUse;}
			set { _adapterToUse = value;}
		}

		/// <summary>Gets or sets the custom function mappings to use. These take higher precedence than the ones in the DQE to use</summary>
		public FunctionMappingStore CustomFunctionMappings
		{
			get { return _customFunctionMappings; }
			set { _customFunctionMappings = value; }
		}
		
		/// <summary>Gets or sets the Context instance to use for entity fetches.</summary>
		public Context ContextToUse
		{
			get { return _contextToUse;}
			set { _contextToUse = value;}
		}
		#endregion
	}
}